#pragma once

#include "muduo/net/EventLoop.h"

#include <rclcpp/rclcpp.hpp>

namespace sensor::camera {

class CameraTrigger {
    using TriggerBeginCallback = std::function<void()>;

public:
    CameraTrigger(muduo::net::EventLoop* loop, double period_s = 0.1);

    void setTriggerBeginCallback(const TriggerBeginCallback& cb);
    void run();

private:
    void do_trigger();

private:
    muduo::net::EventLoop* loop_;
    const double period_s_;
    rclcpp::Logger logger_;
    TriggerBeginCallback cb_;
};

}